apiready = function(){
seajs.use(['../../V',"../../api","../../jquery","../../app","../../service"],function(V,$api,$,app,service){
	var vm = {
		el: '.header',
	  	data: {
	  		activeIndex: 0,
				frameName: '',
	  	},
	  	mounted:function() {

	  	},
	  	methods:{
				closeFrame: function(){
					api.closeFrameGroup({
					    name: 'group1'
					});
					api.closeWin();
				},
				orderTab:function(inds){
					this.activeIndex =inds;
					api.setFrameGroupIndex({
							name: 'group1',
							scroll: true,
							index: inds,
					});
				},
	  	},
	  	created: function(){
				var that = this;
// alert()
				api.openFrameGroup({
						name: 'group1',
						rect: {
								x: 0,
								y: 60,
								w: api.winWidth,
								h: api.winHeight-60
						},
						frames: [{
								name: 'frame1',
								useWKWebView: true,
								url: './shop_order.html',
								bgColor: '#fff',
								pageParam:{shopId: api.pageParam.shopId},
						}, {
								name: 'frame2',
								useWKWebView: true,
								url: '../shop_income/shop_income.html',
								bgColor: '#fff',
								pageParam:{shopId: api.pageParam.shopId},
						}]
				}, function(ret, err) {
						that.activeIndex = ret.index;
						console.log('当前页面index'+that.activeIndex)
						if(that.activeIndex == 1){
							api.setFrameAttr({
							    name: 'shop_order_head',
							    hidden: true
							});

							api.sendEvent({
									name: 'shopIncome',
							});
						}else{
							api.setFrameAttr({
							    name: 'shop_order_head',
							    hidden: false
							});
						}
				});

				api.addEventListener({
						name:'getFrameName'
				},function(ret,err){
					that.frameName = ret.value.frameName;
				});

				api.addEventListener({
						name:'keyback'
				},function(ret,err){
					 	if(that.frameName!=''){
							//这里写上你需要关闭的window或是frame
							api.closeFrame({
								name: that.frameName,
								animation: {
									type: 'push',
									subType: "from_left",
									duration: 300
								},
							});
							that.frameName = '';
						}else{
							api.closeWin();
						}
				});
			}
	};

	var even = function() {}
	var newVue = new Vue(vm);
	even();
});
}
